package cn.keniykey.mc.landterritory.toolkit;

import java.util.Calendar;

public final class TimeUtil {
	private TimeUtil() {}
	/**
	 * 获取字符串时间
	 * @param time 时间参数 [long型]
	 * @return 例如 2018 年 1 月 20 日 3 时 6 分 10 秒 [String字符串]
	 */
	public static String getTimeStr(long time,String str) {
		final Calendar cd = Calendar.getInstance();
		if(time > 0l) cd.setTimeInMillis(time);
		final int year = cd.get(Calendar.YEAR);
		final int month = (cd.get(Calendar.MONTH) + 1);
		final int day = cd.get(Calendar.DAY_OF_MONTH);
		final int hour = cd.get(Calendar.HOUR_OF_DAY);
		final int minute = cd.get(Calendar.MINUTE);
		final int second = cd.get(Calendar.SECOND);
		return Util.setStr(str, year, month, day, hour, minute, second);
	}
}